<?php

namespace Trawind\Remotes\Repositories\Purchase\Vendors;

use Trawind\Remotes\BaseRepository;
use Trawind\Basics\Enums\ServiceDomain;
use Trawind\Remotes\Contracts\Repositories\Purchase\Vendors\VendorRepository;

/**
 * Class AttachmentsRepositoryEloquent.
 *
 * @package namespace Trawind\Remotes\Repositories\Purchase\Vendors;
 * @method  singleFillTransformData($data)
 * @method  fillTransformData($data)
 */
class VendorRepositoryEloquent extends BaseRepository implements VendorRepository
{

    public $baseRoute='/vendors/vendors';
    

    public function __construct()
    {
        $this->domain = ServiceDomain::PURCHASE_DOMAIN();
    }


    public function all($columns = ['*'])
    {
        return $this->setUrl($this->baseRoute)->result();
    }

    public function find($id, $columns = ['*'])
    {
        return $this->setUrl($this->baseRoute.'/'.$id)->result();
    }

    public function getVendorsList($limit)
    {
        // TODO: Implement getVendorsList() method.
    }

    public function create(array $attributes)
    {
        return $this->setUrl($this->baseRoute)
            ->setClientOptions(['form_params' => $attributes])
            ->result('POST');
    }


    public function update(array $attributes, $id)
    {
        return $this->setUrl($this->baseRoute.'/'.$id)
            ->setClientOptions(['form_params' => $attributes])
            ->result('PUT');
    }

    public function changeProgressType(array $id)
    {
        return $this->setUrl($this->baseRoute.'/progress-type')
            ->setClientOptions(['form_params' => ['ids'=>$id]])
            ->result('POST');
    }
}
